<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <script src="../node_modules/axios/dist/axios.js"></script>
</head>
<body>

<!--axios.get(地址？key=value&key2=value2).then(function(response){},function(err){})-->
<!--axios.post(地址,{key:value,key2:value2}).then(function(response){},function(err){})-->
<!--then方法中的回调函数会在请求成功或失败时触发-->
<!--通过回调函数的形参可以获取响应内容或错误信息-->
<input type="button" value="get" id="get">
<input type="button" value="post" id="post">
<script>
    var get = document.getElementById("get");
    get.onclick=function () {
      axios.get("https://autumnfish.cn/api/joke/list?num=6")
          .then(
          function (value) { console.log(value) },
              function (err) {  console.log(err)}
      )
    }
    var post = document.getElementById("post");
    post.onclick=function () {
        axios.post("https://autumnfish.cn/api/user/reg",{username:'yueyue'}).then(function (response) {
         console.log(response)
        },function (err) {
            console.log(err)
        })
    }
</script>
</body>
</html>